package udpSample;

import java.net.*;
import java.io.*;

public class UDPEchoClient {
	public static void lancer(String hostname, int port) {
		try {
			InetAddress ia = InetAddress.getByName(hostname);
			SenderThread sender = new SenderThread(ia, port);
			sender.start();
			Thread receiver = new ReceiverThread(sender.getSocket());
			receiver.start();
		}
		catch (UnknownHostException ex) {
			System.err.println(ex);
		}
		catch (SocketException ex) {
			System.err.println(ex);
		}
	} // end lancer
	
	public static void main(String args[]){
		try {
			UDPEchoClient client = new UDPEchoClient();
			client.lancer("localhost", 2222);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}